* NOTE TO USERS: This folder ("Code Repository") contains all R and Stata code to replicate the results in "Distributional Consequences of Policies for Electric Heat Conversion" (Soren Anderson and Justin Kirkpatrick).


* FOLDER CONTENTS:
	* README.txt (the file you are reading)
	* R (subfolder with R code)
	* Stata (subfolder with Stata code)
	* Data_Archive (subfolder with source datasets)
	* Data_Proc (subfolder with intermediate and final analysis datasets)
	* Final_Output (subfolder with output figures and tables)


* STEP-BY-STEP INSTRUCTIONS FOR REPLICATION:

1. Save "Code Repository" and its contents on your machine. The contents of Data_Proc can be omitted.

2. Run R\1_Preprocess Data.R using R (version 4.2.2 recommended). [Search "YOURPATHHERE" and replace with filepath leading to "Code Repository" on your machine before running.] This will process data using inputs from the Data_Archive folder, outputting intermediate files to Data_Proc. Approximate runtime is 12-14 hours, mainly for processing PRISM temperature grid data.

3. Run R\2_Analysis.R using R (version 4.2.2 recommended). [Search "YOURPATHHERE" and replace with filepath leading to "Code Repository" on our machine before running.] This will produce all analysis, tables, and figures for Section 4 and Appendices A, B, and D. Approximate runtime is 3-4 hours.

4. Run Stata\README_Stata.DO using Stata (version 18 recommended). [Search "YOURPATHHERE" and replace with filepath leading to "Code Repository" on your machine before running.] This will process data using inputs from the Data_Archive and Data_Proc folders, and will produce all analysis, tables, and figures for Section 3 and Appendix C. [Note: Steps 2-3 may be skipped for a partial replication of Section 3 results only based on intermediate datasets generated in steps 2-3 that are already pre-saved in the Data_Proc folder.] Approximate runtime is 5 minutes. 


-----------------------
* CITATIONS TO ORIGINAL DATA SOURCES (in order of appearance in code): 

PRISM Climate Group, Oregon State University. (2022) https://prism.oregonstate.edu. Retrieved April 2024.

Northeast Energy Efficiency Partnerships. (2022). Cold Climate Heat Pump Product Listing. Retrieved from https://neep.org/sites/default/files/ColdClimateAir-SourceHeatPumpSpecificationProductListing-Updated5.3.18.xlsx

National Renewable Energy Laboratory. (2016). U.S. Electric Utility Companies and Rates: Look-up by Zipcode (2015) [data set]. Retrieved from https://data.openei.org/submissions/446.

Energy Information Administration. EIA 861M Monthly Electric Power Industry Report. Retrieved from https://www.eia.gov/electricity/data/eia861m/

Energy Information Administration. EIA 861 Annual Electric Power Industry Report. Retrieved from https://www.eia.gov/electricity/data/eia861/

Georgia Public Services Commission. Residential Rate Survey. Retrieved from https://psc.ga.gov/utilities/electric/residential-rate-survey/

Energy Information Administration. (2010). 2009 Residential Energy Consumption Survey (RECS). Retrieved from https://www.eia.gov/consumption/residential/data/2009/csv/recs2009_public.csv

Energy Information Administration. (2016). 2015 Residential Energy Consumption Survey (RECS). Retrieved from https://www.eia.gov/consumption/residential/data/2015/csv/recs2015_public_v4.csv

Energy Information Administration. (2021). 2020 Residential Energy Consumption Survey (RECS). Retrieved from https://www.eia.gov/consumption/residential/data/2020/csv/recs2020_public_v4.csv

Center for International Earth Science Information Network - CIESIN - Columbia University. 2017. U.S. Census Grids (Summary File 1), 2010. Palisades, New York: NASA Socioeconomic Data and Applications Center (SEDAC). https://doi.org/10.7927/H40Z716C. Accessed April 2024.

Energy Information Administration. (2024). Weekly Heating Oil and Propane Prices. Retrieved from https://www.eia.gov/petroleum/heatingoilpropane/
--https://www.eia.gov/dnav/pet/PET_PRI_WFR_A_EPLLPA_PRS_DPGAL_W.htm
--https://www.eia.gov/dnav/pet/PET_PRI_WFR_A_EPD2F_PRS_DPGAL_W.htm

Energy Information Administration. (2024). Weekly Natural Gas Prices. Retrieved from https://www.eia.gov/dnav/ng/ng_pri_sum_a_epg0_prs_dmcf_a.htm

Oak Ridge National Laboratory. (2017). Natural Gas Local Distribution Company Service Territories. Retrieved from https://hifld-geoplatform.opendata.arcgis.com/datasets/geoplatform::natural-gas-service-territories/explore

*(confidential data) Heating, Air Conditioning and Refrigeration Distributors International. Distributor dashboard. (Appears in appendix only). 

----------------


* LIST OF ALL OUTPUT FILES: All figures, graphics, and tables are indexed in relevant code (R\2_Analysis.R and Stata\README_Stata.DO). To find code producing a specific output, use a find on the table or figure number, or on the filename from the crosswalk below.


---------- Main Text -----------
--Figures--
Fig 1  -- fig_price_levels.png
Fig 2ab-- fig_share_vintage_hp.png; fig_share_vintage_elec.png
Fig 2cd-- fig_share_vintage_elec.png; fig-share_vintage_kero.png
Fig 3  -- fig_ag_cumulative_OLD_AllRECS.png
Fig 4  -- fig_CostScatterOld_Update.png
Fig 5  -- fig_compreg3ud1max.png
Fig 6  -- fig_compreg3ud1maxpct.png
Fig 7  -- PUMA_Savings_3ud.png


--Tables--
Tab 1a -- tab_HeatSharesByRecsVs2009_OldHomes.tex
Tab 1b -- tab_HeatSharesByRecs_NewHomes_AllRecs.tex
Tab 2  -- tab_OldHeatPumpsRegs_Update.tex
Tab 3  -- tab_NewHeatPumpRegs_Update.tex




---------- Appendix -----------
--Figures--
A.1 -- PlotAnnualShipments-1.png
A.2 -- PlotAnnualChangeChipments.png
A.3 -- PlotAnnualShares-1.png
B.1 -- 2COP.png
B.2 -- AVGCOP_TOP.png
C.1 -- fig_CostScatterOld_NoCovid_Update.png
D.1 -- predmbtu.png
D.2 -- PUMA_Savings_elresud.png
D.3 -- PUMA_Savings_ngud.png
D.4 -- PUMA_Savings_propud.png
D.5 -- PUMA_Savings_foilud.png
D.6 -- electricprices.png
D.7 -- DOEcops.png (2 panels)
D.8 -- PUMA_Savings_DOEoverelres.png
D.9 -- DOEsave.png (2 panels)
D.10-- fig_compreg4total.png
D.11-- fig_compreg4incremental.png
D.12-- PUMA_Savings_3udnetshare.png
D.13-- fig_compreg3ud1netmax.png
D.14-- fig_compreg3ud1netmaxpct.png
D.15-- PUMA_Savings_3udnet.png
D.16-- PUMA_Savings_3udga.png
D.17-- us_state_used_2023-06-04.png
D.18-- share_to_ng.png (uses confidential data)
D.19-- share_to_popdens.png (uses confidential data)


--Tables--
C.1a -- tab_HeatSharesByRecs_OldHomes.tex
C.1b -- tab_HeatSharesByRecsVs2009AddControls_OldHomes.tex
C.2  -- tab_OldHeatPumpRegs_NoCovid_Update.tex
C.3  -- tab_OldRegs_Update.tex
C.4  -- tab_NewRegs_Update.tex
D.1  -- tab_mbtureg1.tex
D.2  -- tab_compreg3max.tex
D.3  -- tab_compreg3maxpct.tex
D.4  -- tab_compreg4.tex
D.5  -- tab_compreg3netmax.tex
D.6  -- tab_compreg3netmaxpct.tex
D.7  -- tab_compreg3maxga.tex
D.8  -- tab_compreg3maxpctga.tex
